Skip to content

feat(sandbox): enforce proxy-aware network routing in sandbox#11113

Open
viyatb-oai wants to merge 9 commits intomainfrom
codex/viyatb/sandbox-proxy-wiring
Open

feat(sandbox): enforce proxy-aware network routing in sandbox#11113
viyatb-oai wants to merge 9 commits intomainfrom
codex/viyatb/sandbox-proxy-wiring

Conversation

@viyatb-oai
Copy link
Collaborator

Summary

  • expand proxy env injection to cover common tool env vars (HTTP_PROXY/HTTPS_PROXY/ALL_PROXY/NO_PROXY families + tool-specific variants)
  • harden macOS Seatbelt network policy generation to route through inferred loopback proxy endpoints and fail closed when proxy env is malformed
  • thread proxy-aware Linux sandbox flags and add minimal bwrap netns isolation hook for restricted non-proxy runs
  • add/refresh tests for proxy env wiring, Seatbelt policy generation, and Linux sandbox argument wiring

@viyatb-oai viyatb-oai force-pushed the codex/viyatb/sandbox-proxy-wiring branch from e3a69d3 to f16c393 Compare February 8, 2026 21:30
@bolinfest bolinfest force-pushed the pr11105 branch 3 times, most recently from a26207b to 954e0d1 Compare February 8, 2026 21:35
@viyatb-oai viyatb-oai changed the title eat(sandbox): enforce proxy-aware network routing in sandbox feat(sandbox): enforce proxy-aware network routing in sandbox Feb 8, 2026
@bolinfest bolinfest force-pushed the pr11105 branch 5 times, most recently from 1c3bade to 714e595 Compare February 9, 2026 02:42
@viyatb-oai viyatb-oai force-pushed the codex/viyatb/sandbox-proxy-wiring branch 2 times, most recently from d2b8198 to c5b31de Compare February 9, 2026 02:48
Base automatically changed from pr11105 to main February 9, 2026 03:32
@viyatb-oai viyatb-oai force-pushed the codex/viyatb/sandbox-proxy-wiring branch from c5b31de to 20006b9 Compare February 9, 2026 03:38
@viyatb-oai viyatb-oai marked this pull request as ready for review February 9, 2026 06:47
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8862494880

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +48 to 62
let install_network_seccomp =
!sandbox_policy.has_full_network_access() && !allow_network_for_proxy;

// `PR_SET_NO_NEW_PRIVS` is required for seccomp, but it also prevents
// setuid privilege elevation. Many `bwrap` deployments rely on setuid, so
// we avoid this unless we need seccomp or we are explicitly using the
// legacy Landlock filesystem pipeline.
if !sandbox_policy.has_full_network_access()
if install_network_seccomp
|| (apply_landlock_fs && !sandbox_policy.has_full_disk_write_access())
{
set_no_new_privs()?;
}

if !sandbox_policy.has_full_network_access() {
if install_network_seccomp {
install_network_seccomp_filter_on_current_thread()?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not drop Linux network seccomp when proxy env is set

On Linux, allow_network_for_proxy disables the network seccomp filter for any non-empty proxy env var, which means a restricted SandboxPolicy now allows unrestricted network syscalls whenever HTTP_PROXY/etc. is present. A sandboxed process can then ignore the proxy env and open direct connections, so this change removes the previous network isolation guarantee (regression from “no network” to “full network”) even if the proxy URL is invalid or points off-host. Consider keeping network seccomp in place (or otherwise enforcing proxy-only egress) instead of treating any proxy env as a safe bypass.

Useful? React with 👍 / 👎.

Copy link
Collaborator

@nornagon-openai nornagon-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sandbox changes seem safe in that they are strictly less permissive than previously. didn't review the rest of the PR in depth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants